

import type { Iarticle } from './entity';
import type { IPageParams } from '@/types/table'
import request from '@/api/request'

export function getPageList(params: IPageParams) {
  return request({
    url: `admin/article/list`,
    method: 'get',
    params,
    loading: true
  })
}
export function categoryList(params: any) {
  return request({
    url: `admin/category/list`,
    method: 'get',
    params,
    loading: true
  })
}
export function articleDel(data) {
  return request({
    url: `admin/article/delete`,
    method: 'post',
    data
  })
}
export function articleinfo(id: number) {
  return request({
    url: `/admin/article/info`,
    method: 'GET',
    params: { id }
  })
}
export function articleSelect(id) {
  return request({
    url: `admin/article/select`,
    method: 'get'
  })
}

export function articleAddup(data) {
  return request({
    url: `admin/article/${!data.id ? 'save' : 'update'}`,
    method: 'post',
    params: { id: data.id },
    data
  })
}
